package com.boyi.cycling_master.ui;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.boyi.cycling_master.R;
import com.boyi.cycling_master.application.CyclingApplication;
import com.boyi.cycling_master.common.ActivityStackManager;
import com.boyi.cycling_master.ui.base.BaseActivity;

/**
 *
 * @date 2017/8/11/011 10:41
 *
 * @author Lee_Mofeel
 *
 * @version 1.0
 *
 * @Description 
 *              Logo界面
 */

public class LogoActivity extends BaseActivity implements View.OnClickListener{
    private android.widget.TextView tvLogoBtnLogin;
    private android.widget.TextView tvLogoBtnRegister;

    @Override
    public int getContentViewId() {
        return R.layout.activity_logo;
    }

    @Override
    public void initView() {

        tvLogoBtnLogin = (TextView) findViewById(R.id.tv_logo_btn_login);
        tvLogoBtnLogin.setOnClickListener(this);
        tvLogoBtnRegister = (TextView) findViewById(R.id.tv_logo_btn_register);
        tvLogoBtnRegister.setOnClickListener(this);
    }

    @Override
    public void initLogic() {
        /* 如果在数据库中已经存有用户信息 那么会直接跳过当前界面 */
        if(CyclingApplication.getInstance().getUserInfo()!=null){
            startActivity(new Intent(this,PersonCenterActivity.class));
            Log.d("LoginDebug","haveUser");
            ActivityStackManager.getInstance().killActivity(LogoActivity.class);
        }

    }

    @Override
    public void getBundleExtras(Bundle bundle) {

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.tv_logo_btn_login:
                startActivity(new Intent(this,PhoneLoginActivity.class));
                break;
            case R.id.tv_logo_btn_register:
                startActivity(new Intent(this,RegisterPhoneActivity.class));
                break;
        }
    }
}
